package com.suray.wcs.service.system.scheduled;

import com.suray.commin.core.utils.DateUtils;
import com.suray.wcs.service.util.BackUpDataBaseManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 定时备份数据库
 */
@Component("BackUpDatabase")
public class BackUpDatabase {
    private Logger logger = LoggerFactory.getLogger(BackUpDatabase.class);

    @Autowired
    private BackUpDataBaseManager backUpDataBaseManager;

    /**
     * 定时备份数据库
     */
    public void backUpDatabase(){
        try {
            backUpDataBaseManager.exportSql(DateUtils.getDate());
        } catch (Exception e) {
            logger.error("备份数据库失败: " + e.getLocalizedMessage());
        }
    }

}
